package com.anycl.design.behavioral.state;

/**
 * 上下文角色
 */
public class Ctx {

    public static final State state1 = new ConcreteState1();
    public static final State state2 = new ConcreteState2();

    private State currentState;

    public State getCurrentState() {
        return currentState;
    }

    public void setCurrentState(State currentState) {
        this.currentState = currentState;
        this.currentState.setContext(this);
    }

    public void request1() {
        this.currentState.handle1();
    }

    public void request2() {
        this.currentState.handle2();
    }
}
